<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns="http://www.w3.org/1999/xhtml" xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:st="http://www.whatisjee.com/ssf/tags" xmlns:sf="http://www.whatisjee.com/ssf/functions" xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib" template="/common/template/base.xhtml">
	<ui:define name="inForm">
		<div id="header">
			<div id="banner">
				<div id="logo">
					<h:graphicImage value="/common/image/#{messages['cmm.logo']}" alt="#{messages['cmm.appName']}" />
				</div>
				<h:panelGroup styleClass="user-info" rendered="#{identity.loggedIn}" layout="block">
					<h:panelGroup styleClass="quiz">
						<h:inputText id="itQuiz" value="#{loginAct.quiz}" maxlength="50" />
						<h:commandLink action="#{loginAct.search}" immediate="true">
							<h:graphicImage value="/common/image/search.gif" alt="#{messages['cmm.search']}" title="#{messages['cmm.search']}" />
						</h:commandLink>
					</h:panelGroup>
					<rich:spacer style="width:5px"/>
					<h:panelGroup styleClass="icon">
						<h:graphicImage value="/common/image/user.png" />
						<h:outputText value="#{credentials.username}" />
					</h:panelGroup>
					<rich:spacer style="width:5px"/>
					<h:commandLink action="#{loginAct.logout}" immediate="true" rendered="#{identity.loggedIn}" styleClass="icon">
						<h:graphicImage value="/common/image/logout.png" />
						<h:outputText value="#{messages['logout']}" />
					</h:commandLink>
				</h:panelGroup>
			</div>
			<st:tabs rendered="#{not identity.loggedIn}">
				<st:tab url="/login.xhtml" label="#{messages['login']}" first="true" last="true" />
				<st:tab url="/error.xhtml" label="#{messages['error']}" styleClass="err" rendered="#{sf:isTabSelected(null,'/error.xhtml')}" />
			</st:tabs>
			<st:tabs rendered="#{identity.loggedIn}">
				<st:tab url="/secured/index.xhtml" label="#{messages['home']}" first="true" />
				<st:tab pid="2" label="#{messages['administration']}" last="true" sub="true">
					<st:subtabs>
						<st:subtab url="/admin/user.xhtml" label="#{messages['user.title']}" rendered="#{s:hasRole('role.admin')}" />
						<st:subtab url="/admin/users.xhtml" label="#{messages['user.query']}" rendered="#{s:hasRole('role.admin')}" />
						<st:subtab url="/admin/logs.xhtml" label="#{messages['log']}" rendered="#{s:hasRole('role.admin')}" />
						<st:subtab url="/secured/password.xhtml" label="#{messages['home.changePwd']}" />
					</st:subtabs>
				</st:tab>
				<st:tab url="/error.xhtml" label="#{messages['error']}" styleClass="err" rendered="#{sf:isTabSelected(null,'/error.xhtml')}" />
			</st:tabs>
		</div>		
		<div id="content">
			<st:messages />
			<ui:insert name="content" />
		</div>
		<input type="hidden" id="pid" name="pid" value="#{param['pid']}" />
	</ui:define>
</ui:composition>